package com.irdstudio.efp.nls.service.impl.yed.repay;

import com.alibaba.fastjson.JSON;
import com.irdstudio.basic.framework.core.constant.EsbEnums;
import com.irdstudio.basic.framework.core.constant.SDicToExternalConstant;
import com.irdstudio.basic.framework.core.exception.BizException;
import com.irdstudio.basic.framework.core.exception.OcmSystemException;
import com.irdstudio.basic.framework.core.util.DateUtility;
import com.irdstudio.basic.framework.core.util.StringUtil;
import com.irdstudio.basic.framework.core.util.TimeUtil;
import com.irdstudio.basic.framework.core.util.sdic.SDicToExternal;
import com.irdstudio.efp.cus.service.facade.CusIndivService;
import com.irdstudio.efp.cus.service.vo.CusIndivVO;
import com.irdstudio.efp.esb.common.client.resp.EsbRespSysHeadBean;
import com.irdstudio.efp.esb.common.constant.EsbBizEnums;
import com.irdstudio.efp.esb.service.bo.req.sed.repay.ReqLoanAccountBean;
import com.irdstudio.efp.esb.service.bo.req.sed.repay.ReqLoanRepayBean;
import com.irdstudio.efp.esb.service.bo.req.sed.repay.ReqLoanRepayResultQryBean;
import com.irdstudio.efp.esb.service.bo.resp.sed.repay.RespLoanRepayBean;
import com.irdstudio.efp.esb.service.bo.resp.sed.repay.RespLoanRepayResultQryBean;
import com.irdstudio.efp.esb.service.facade.EsbInvokeWrapper;
import com.irdstudio.efp.esb.service.facade.sed.repay.LoanRepayResultQryService;
import com.irdstudio.efp.esb.service.facade.sed.repay.LoanRepayService;
import com.irdstudio.efp.limit.service.facade.LmtPrdContService;
import com.irdstudio.efp.limit.service.vo.LmtPrdContVO;
import com.irdstudio.efp.loan.service.facade.AccLoanService;
import com.irdstudio.efp.loan.service.facade.LoanRepayDetailService;
import com.irdstudio.efp.loan.service.vo.AccLoanVO;
import com.irdstudio.efp.loan.service.vo.LoanRepayDetailVO;
import com.irdstudio.efp.nls.common.constant.NlsApplyInfoEnums;
import com.irdstudio.efp.nls.common.constant.sed.SedNlsEnum;
import com.irdstudio.efp.nls.common.constant.yed.NlsReplyFlowStatus;
import com.irdstudio.efp.nls.common.constant.yed.YedCommonConstant;
import com.irdstudio.efp.nls.common.exception.LoanRepaySyncException;
import com.irdstudio.efp.nls.common.exception.RepayException;
import com.irdstudio.efp.nls.service.facade.NlsApplyInfoService;
import com.irdstudio.efp.nls.service.facade.NlsQueueSoltComnService;
import com.irdstudio.efp.nls.service.impl.yed.queue.YedRepaySoltServiceImpl;
import com.irdstudio.efp.nls.service.vo.NlsApplyInfoVO;
import com.irdstudio.efp.nls.service.vo.queue.NlsProcessBizVO;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;

import java.math.BigDecimal;
import java.util.*;


/**
 * 需求编号：【2019D0509】（业务提的需求编号）
 * 问题编号：【】（若不是因为修复问题而新增该类，则留空）
 * 开发人员：【wanglh4】
 * 创建日期：【2020/7/28 10:29】
 * 功能描述：
 */
@Service("yedRepaymentApplyService")
public class YedRepaymentApplyServiceImpl  extends YedRepaySoltServiceImpl {
    private static final Logger logger = LoggerFactory.getLogger(YedRepaymentApplyServiceImpl.class);

    @Override
    public void doExecute(NlsProcessBizVO nlsProcessBizVo, LoanRepayDetailVO loanRepayDetailVO) throws Exception {
        String setlSeq = loanRepayDetailVO.getSetlSeq();
        String billNo = loanRepayDetailVO.getLoanNo();
        logger.info("======>还款申请准入服务开始,流水号为:" + setlSeq + "<======");
        try {
            /* 判断是否是成功还款后的系统内部异常处理 */
            if (SedNlsEnum.ExceptionLocation.REPAY_SUCCESS_AFTER_EXCEPTION.getValue().equals(loanRepayDetailVO.getExceptionLocation())) {
                AccLoanVO accLoanVO = new AccLoanVO();
                accLoanVO.setBillNo(billNo);
                accLoanVO = accLoanService.queryByPk(accLoanVO);
                if (Objects.isNull(accLoanVO)) {
                    throw new OcmSystemException(SedNlsEnum.ExceptionLocation.REPAY_SUCCESS_AFTER_EXCEPTION.getValue(), "还款成功后，根据借据号【" + billNo + "】，获取到的借据信息为空！");
                }
            } else {
                this.excuteRepayMain(loanRepayDetailVO, nlsProcessBizVo);
            }
        } catch (LoanRepaySyncException e) {
            logger.error("还款流水号为:【" + loanRepayDetailVO.getSetlSeq() + "】执行还款后同步任务执行失败 由定时任务处理");
            nlsProcessBizVo.setExceptionFlag(true);
            nlsProcessBizVo.setExceptionMsg(e);
        } catch (RepayException e) {
            logger.error("还款流水号为:【" + loanRepayDetailVO.getSetlSeq() + "】执行还款失败 由补偿任务处理");
            nlsProcessBizVo.setExceptionFlag(true);
            nlsProcessBizVo.setExceptionMsg(e);
        } catch (Exception e) {
            logger.error(Arrays.toString(e.getStackTrace()));
            nlsProcessBizVo.setExceptionFlag(true);
            nlsProcessBizVo.setExceptionMsg(e);
        } finally {
            logger.info("======>还款申请准入服务结束,流水号为:" + setlSeq + "<======");
        }
    }

    /**
     * 还款主流程处理
     *
     * @author qiuyf
     * @version 0.1 初始为0.1,后续变更则修改
     * @since 2019年6月27日 下午9:17:17
     */
    private void excuteRepayMain(LoanRepayDetailVO loanRepayDetailVO, NlsProcessBizVO nlsProcessBizVo) throws Exception {
        String setlSeq = loanRepayDetailVO.getSetlSeq();
        String globalSerno = loanRepayDetailVO.getGlobalSerno();
        String billNo = loanRepayDetailVO.getLoanNo();
        // 根据提前还款申请传送过来的全局流水号，调用贷款回收结果查询
        logger.info("根据全局流水号【" + globalSerno + "】，调用贷款还款结果查询接口开始-----------------------------------");
        ReqLoanRepayResultQryBean reqLoanRepResQryBean = new ReqLoanRepayResultQryBean();
        reqLoanRepResQryBean.setTxnGlblSrlNo(globalSerno);
        RespLoanRepayResultQryBean respLoanRepResQryBean = new RespLoanRepayResultQryBean();
        EsbInvokeWrapper esbInvokeWrapper = new EsbInvokeWrapper(loanRepayResultQryService,reqLoanRepResQryBean,nlsQueueSoltComnService);
        respLoanRepResQryBean = (RespLoanRepayResultQryBean) esbInvokeWrapper.invoke3Threes();

        logger.info("根据全局流水号【" + globalSerno + "】，调用贷款还款结果查询接口结束-------返回结果为：" + JSON.toJSONString(respLoanRepResQryBean));

        //通过借据号获取借据信息
        AccLoanVO accLoanVO = this.getAccLoan(billNo);

        String isRepay = respLoanRepResQryBean.getQrySt();
        if (SedNlsEnum.QuerySts.WITHOUT.getValue().equals(isRepay)) {
            /* 执行还款  */
            this.excuteRepay(loanRepayDetailVO, accLoanVO);
            try {
                repaymentInfoSyncService.doExecute(nlsProcessBizVo, loanRepayDetailVO);
            } catch (Exception e) {
                logger.error("还款申请流水号【 " + setlSeq + "】，全局流水号【" + globalSerno + "】，成功还款后执行同步任务失败！");
                throw new LoanRepaySyncException("还款后同步任务执行失败");
            }
        }
    }

    public AccLoanVO getAccLoan(String billNo) throws BizException {
        AccLoanVO accLoanVO = new AccLoanVO();
        accLoanVO.setBillNo(billNo);
        accLoanVO = accLoanService.queryByPk(accLoanVO);
        if (Objects.isNull(accLoanVO)) {
            throw new BizException("调用贷款回收接口前，根据借据号【" + billNo + "】，获取到的借据信息为空！");
        }
        return accLoanVO;
    }

    /**
     * 组装还款接口请求报文
     *
     * @author qiuyf
     * @version 0.1 初始为0.1,后续变更则修改
     * @since 2019年5月14日 下午3:11:46
     */
    private ReqLoanRepayBean buildReqLoanRepayBean(LoanRepayDetailVO loanRepayDetailVO, AccLoanVO accLoanVO) throws Exception {

        ReqLoanRepayBean reqLoanRepayBean = new ReqLoanRepayBean();
        //贷款号
        reqLoanRepayBean.setLoanNo(accLoanVO.getLoanSeq());
        //发放号
        reqLoanRepayBean.setDistrNo(accLoanVO.getDistrNo());
        //还款日期
        reqLoanRepayBean.setRpyDt(StringUtil.isNotEmpty(loanRepayDetailVO.getSetlApplyDt()) ? DateUtility.format10To8(loanRepayDetailVO.getSetlApplyDt()) : null);
        //还款类型
        try {
            reqLoanRepayBean.setRpyType(SDicToExternal.getExternalSysDicVal(SDicToExternalConstant.SYSID_IFP, SDicToExternalConstant.SETL_TYP, loanRepayDetailVO.getSetlTyp()));
        } catch (Exception e) {
            logger.error("还款类型字典项类型转换异常！", e);
            throw new Exception("调用贷款回收接口组装请求报文时，出现还款类型字典项转换异常！");
        }
        //还款金额
        reqLoanRepayBean.setRpyAmt(loanRepayDetailVO.getTotalAmt() == null ? BigDecimal.ZERO.toString() : loanRepayDetailVO.getTotalAmt().toString());
        //还款本金
        reqLoanRepayBean.setRpyPrin(caculRpyPrin(loanRepayDetailVO));
        //还款期次
        reqLoanRepayBean.setRpyTime(loanRepayDetailVO.getRepayTerm());
        //还款原因
        reqLoanRepayBean.setRpyRsn(loanRepayDetailVO.getRepayReason());
        // 手机
        reqLoanRepayBean.setMblNo(getMobile(loanRepayDetailVO.getIdType(), loanRepayDetailVO.getIdNo(), accLoanVO.getBillNo()));

        //
        BigDecimal loanTe = accLoanVO.getLoanTerm();
        String loanTermTy = accLoanVO.getLoadTermType();
        String blgAcctProdType = "";
        if ((loanTermTy.equals("M") && loanTe.compareTo(new BigDecimal("12"))>0) ||
                (loanTermTy.equals("Y") && loanTe.compareTo(new BigDecimal("1"))>0) ||
                (loanTermTy.equals("D") && loanTe.compareTo(new BigDecimal("365"))>0)){
            blgAcctProdType = "10003004";
        }else{
            blgAcctProdType = "10003003";
        }

        //结算信息数组----------------- 组装 start ------------------------------------------------
        List<ReqLoanAccountBean> reqLoanAccountList = new ArrayList<ReqLoanAccountBean>();
        if (StringUtil.isStrNotEmpty(loanRepayDetailVO.getAmtType())) {
            String[] amtType = loanRepayDetailVO.getAmtType().split(",");
            for (int i = 0; i < amtType.length; i++) {
                ReqLoanAccountBean reqLAccBean = new ReqLoanAccountBean();
                //金额类型
                reqLAccBean.setAmtType(amtType[i]);
                //结算金额
                BigDecimal setlAmt = BigDecimal.ZERO;
                if (EsbEnums.AmtType.ALL.getValue().equals(amtType[i])) {
                    //本次还款总计金额
                    setlAmt = loanRepayDetailVO.getTotalAmt();
                } else if (EsbEnums.AmtType.PRINCIPAL.getValue().equals(amtType[i])) {
                    //提前还本金额
                    setlAmt = loanRepayDetailVO.getSetlOdPrcpAmt();
                } else if (EsbEnums.AmtType.INTEREST.getValue().equals(amtType[i])) {
                    //还款时总拖欠利息
                    setlAmt = loanRepayDetailVO.getAllOdNormIntAmt();
                } else if (EsbEnums.AmtType.COMP_INTEREST.getValue().equals(amtType[i])) {
                    //还款时总拖欠复利
                    setlAmt = loanRepayDetailVO.getAllOdCommIntAmt();
                } else if (EsbEnums.AmtType.DEF_INTEREST.getValue().equals(amtType[i])) {
                    //还款时总拖欠罚息
                    setlAmt = loanRepayDetailVO.getAllOdIntAmt();
                } else if (EsbEnums.AmtType.FEE.getValue().equals(amtType[i])) {
                    //归还费用总计
                    setlAmt = loanRepayDetailVO.getTotalFee();
                }
                reqLAccBean.setBlgAmt(setlAmt == null ? BigDecimal.ZERO.toString() : setlAmt.toString());

                //结算账户分类
                reqLAccBean.setBlgAcctCl(loanRepayDetailVO.getSetlAcctClassify());
                //结算方式  = 还款模式
                reqLAccBean.setBlgMth(loanRepayDetailVO.getSetlMode());
                //账户分类  = 账户类型
                reqLAccBean.setAcctCtgry(loanRepayDetailVO.getAcctTyp());
                //结算客户号
                reqLAccBean.setBlgCstNo(loanRepayDetailVO.getCusNo());
                //结算账号 = 还款账号
                reqLAccBean.setBlgAcctNo(loanRepayDetailVO.getDisbAcNo());
                //结算账户产品类型（优e贷 : 短期(10003003)/中长期(10003004)
                //reqLAccBean.setBlgAcctProdType(loanRepayDetailVO.getSetlAcctPrdType());
                reqLAccBean.setBlgAcctProdType(blgAcctProdType);
                //结算账户币种
                try {
                    reqLAccBean.setBlgAcctCurrCd(SDicToExternal.getExternalSysDicVal(SDicToExternalConstant.SYSID_IFP, SDicToExternalConstant.CUR_TYPE, loanRepayDetailVO.getSetlCurr()));
                } catch (Exception e) {
                    logger.error("币种字典项类型转换异常！", e);
                    throw new Exception("调用贷款回收接口组装请求报文时，出现币种字典项转换异常！");
                }
                //结算账户序号
                reqLAccBean.setBlgAcctSrlNo(loanRepayDetailVO.getSetlAcctSeq());
                //自动锁定标记
                reqLAccBean.setAtmLockMark(loanRepayDetailVO.getAtmLockMark());
                //贷款优先级
                reqLAccBean.setLoanPrtyLvl(loanRepayDetailVO.getLoanPrtyLvl());
                //结算权重
                reqLAccBean.setBlgRto(loanRepayDetailVO.getSetlWeight());
                //行内外标志
                reqLAccBean.setBankInsdOutSdFlg(loanRepayDetailVO.getBankInOut());
                //变更方式
                reqLAccBean.setMdfMd(loanRepayDetailVO.getModifyMode());

                reqLoanAccountList.add(reqLAccBean);
            }
        }
        //结算信息数组----------------- 组装 end ------------------------------------------------
        reqLoanRepayBean.setIntSetInfArry(reqLoanAccountList.toArray(new ReqLoanAccountBean[reqLoanAccountList.size()]));
        String str = "";
        return reqLoanRepayBean;
    }

    private String getMobile(String idType, String idNo, String billNo) throws BizException {
        String cusId = cusIndivService.getCusIdByCertCode(idType, idNo);
        if (StringUtils.isEmpty(cusId)) {
            logger.error("调用贷款回收接口前，根据借据号【" + billNo + "】，获取到的客户手机号为空！");
            throw new BizException("调用贷款回收接口前，根据借据号【" + billNo + "】，获取到的客户手机号为空！");
        }
        CusIndivVO cusIndivVO = new CusIndivVO();
        cusIndivVO.setCusId(cusId);
        cusIndivVO = cusIndivService.queryByPk(cusIndivVO);
        if (Objects.nonNull(cusIndivVO)) {
            return cusIndivVO.getPhone();
        } else {
            logger.error("调用贷款回收接口前，根据借据号【" + billNo + "】，获取到的客户手机号为空！");
            throw new BizException("调用贷款回收接口前，根据借据号【" + billNo + "】，获取到的客户手机号为空！");
        }

    }


    private void excuteRepay(LoanRepayDetailVO loanRepayDetailVO, AccLoanVO accLoanVO) throws Exception {
        String setlSeq = loanRepayDetailVO.getSetlSeq();
        //  1. 调用贷款还款接口
        logger.info("调用贷款还款接口开始----------------------还款申请流水号：" + setlSeq);
        // 1.1组装贷款还款接口请求报文
        ReqLoanRepayBean reqLoanRepayBean = this.buildReqLoanRepayBean(loanRepayDetailVO, accLoanVO);
        // 1.2调用贷款还款接口
        EsbRespSysHeadBean esbRespSysHeadBean = new EsbRespSysHeadBean();
        RespLoanRepayBean respLoanRepayBean = new RespLoanRepayBean();
        try {
            respLoanRepayBean = loanRepayService.loanRepay(reqLoanRepayBean,loanRepayDetailVO);
            // 按期次还款 还款期次设置为零 在发起接口时候按期次还款落就为零 不置为零无法修改数据
            if ("06".equals(loanRepayDetailVO.getSetlTyp())){
                loanRepayDetailVO.setRepayTerm("0");
            }
        } catch (Exception e) {
            // 按期次还款 还款期次设置为零 在发起接口时候按期次还款落就为零 不置为零无法修改数据
            if ("06".equals(loanRepayDetailVO.getSetlTyp())){
                loanRepayDetailVO.setRepayTerm("0");
            }
            throw new RepayException(e.getMessage());
        }
        logger.info("调用贷款还款接口结束----------------------还款申请流水号：" + setlSeq);
        String sysHeadRetCode = respLoanRepayBean.getSysHeadRetCode();
        if (EsbBizEnums.RetCodeEnum.SUCCESS.getVALUE().equals(sysHeadRetCode)) {
            this.updStateAndLmt(loanRepayDetailVO, accLoanVO);
        } else {
            throw new RepayException("调用贷款还款接口失败：" + setlSeq);
        }
        loanRepayDetailVO.setRpyNo(respLoanRepayBean.getRpyNo());
        loanRepayDetailVO.setTxnRefrNo(respLoanRepayBean.getTxnRefrNo());
        loanRepayDetailVO.setFlowStatus(NlsReplyFlowStatus.FLOW_STATUS_3);
        loanRepayDetailVO.setRpSts(YedCommonConstant.RY_STS_1);
        loanRepayDetailService.updateByPk(loanRepayDetailVO);
    }


    /**
     * 还款成功后处理
     * 1. 更新还款审批状态为“通过”
     * 2. 更新授信协议信息
     *
     * @author qiuyf
     * @version 0.1 初始为0.1,后续变更则修改
     * @since 2019年5月14日 下午4:39:07
     */
    public void updStateAndLmt(LoanRepayDetailVO loanRepayDetailVO, AccLoanVO accLoanVO) throws RepayException {
        String setlSeq = loanRepayDetailVO.getSetlSeq();
        logger.info("======>还款申请准入服务执行到还款成功后,后处理开始,流水号为:" + setlSeq + "<======");
        try {
            // 更新还款申请状态为“通过”
            loanRepayDetailVO.setWfApprSts(NlsApplyInfoEnums.NlsApplyState.DEALING.getKey());
            /**
             * mycat中不允许修改作为分库依据的列，所以更新的时候去掉“loan_no”
             * 将更新执行的bean中loanNo字段赋值为null，更新语句会检测是否为空，再做更新。
             * @date 2019/06/15
             * @author qiuyf
             *
             * 【2019/06/17，需求要求不使用mycat分片】
             * loanRepayDetailVO.setLoanNo(null);
             */
            int num = loanRepayDetailService.updateByPk(loanRepayDetailVO);

            if (num < 0) {
                logger.error("更新还款申请状态为“通过”，执行失败！");
                throw new OcmSystemException(SedNlsEnum.ExceptionLocation.REPAY_SUCCESS_AFTER_EXCEPTION.getValue(), "还款成功后，更新还款申请状态为“处理中”，执行失败！--------还款申请流水号：" + setlSeq);
            }
            // 进行额度恢复（更新已用额度、可用额度）
            //获取授信申请流水号
            String lmtApplySeq = this.getLmtApplySeq(accLoanVO.getApplySeq());
            //获取授信协议信息
            LmtPrdContVO lmtPrdContVO = lmtPrdContService.qryLmtPrdContByLmtApplySeq(lmtApplySeq);
            if (Objects.nonNull(lmtPrdContVO)) {
                BigDecimal lmtAmt = lmtPrdContVO.getLmtAmt();
                BigDecimal occAmt = Optional.ofNullable(lmtPrdContVO.getOccAmt()).orElse(BigDecimal.ZERO);
                BigDecimal preOccAmt = Optional.ofNullable(lmtPrdContVO.getPreOccAmt()).orElse(BigDecimal.ZERO);
                BigDecimal rpyPrin = loanRepayDetailVO.getSetlOdPrcpAmt();

                //已用额度 = 原已用额度  - 还款本金
                lmtPrdContVO.setOccAmt(occAmt.subtract(rpyPrin));
                //可用额度  = 授信额度 - 已用额度 - 预占用额度  + 还款本金
                lmtPrdContVO.setAvailAmt(lmtAmt.subtract(occAmt).subtract(preOccAmt).add(rpyPrin));
                //最近更新时间
                lmtPrdContVO.setLastUpdateTime(TimeUtil.getCurrentDateTime());

                int numLmt = lmtPrdContService.updateByPk(lmtPrdContVO);

                if (numLmt < 0) {
                    throw new RepayException(SedNlsEnum.ExceptionLocation.REPAY_SUCCESS_AFTER_EXCEPTION.getValue(),
                            "还款成功后，更新授信协议信息失败！还款申请流水号【" + setlSeq + "】，授信申请流水号：" + lmtApplySeq);
                }
            } else {
                logger.error("还款成功后，进行额度恢复，通过授信申请流水号【" + lmtApplySeq + "】，获取到的授信协议信息为空！");
                throw new RepayException(SedNlsEnum.ExceptionLocation.REPAY_SUCCESS_AFTER_EXCEPTION.getValue(),
                        "通过授信申请流水号【 " + lmtApplySeq + "】，查询到的授信协议信息为空！还款申请流水号：" + setlSeq);
            }
        } catch (Exception e) {
            throw new RepayException(e);
        } finally {
            logger.info("======>还款申请准入服务执行到还款成功后,后处理结束,流水号为:" + setlSeq + "<======");
        }
    }

    /**
     * 通过支用申请流水号查询授信申请流水号
     *
     * @author qiuyf
     * @version 0.1 初始为0.1,后续变更则修改
     * @since 2019年6月27日 下午8:05:51
     */
    private String getLmtApplySeq(String applySeq) throws OcmSystemException {
        NlsApplyInfoVO nlsApplyInfoVO = new NlsApplyInfoVO();
        nlsApplyInfoVO.setApplySeq(applySeq);
        nlsApplyInfoVO = nlsApplyInfoService.queryByPk(nlsApplyInfoVO);
        if (Objects.isNull(nlsApplyInfoVO)) {
            throw new OcmSystemException("还款成功后更新授信协议信息时，通过支用申请流水号【" + applySeq + "】，获取到的支用信息为空！");
        }
        if (StringUtil.isNullorBank(nlsApplyInfoVO.getLmtApplySeq())) {
            throw new OcmSystemException("还款成功后更新授信协议信息时，通过支用申请流水号【" + applySeq + "】，获取到的授信申请流水号为空！");
        }
        return nlsApplyInfoVO.getLmtApplySeq();
    }

    private String caculRpyPrin(LoanRepayDetailVO loanRepayDetailVO){
        String rpyPrin = "";
        if ("02".equals(loanRepayDetailVO.getSetlTyp())){
            rpyPrin = loanRepayDetailVO.getSetlOdPrcpAmt() == null ? BigDecimal.ZERO.toString() : loanRepayDetailVO.getSetlOdPrcpAmt().toString();
        }else{
            rpyPrin = loanRepayDetailVO.getTotalAmt() == null ? BigDecimal.ZERO.toString() : loanRepayDetailVO.getTotalAmt().toString();
        }
        return rpyPrin;
    }

    @Autowired
    @Qualifier("loanRepayResultQryService")
    private LoanRepayResultQryService loanRepayResultQryService;

    @Autowired
    @Qualifier("accLoanService")
    private AccLoanService accLoanService;

    @Autowired
    @Qualifier("loanRepayService")
    private LoanRepayService loanRepayService;

    @Autowired
    @Qualifier("loanRepayDetailService")
    private LoanRepayDetailService loanRepayDetailService;

    @Autowired
    @Qualifier("nlsApplyInfoService")
    private NlsApplyInfoService nlsApplyInfoService;

    @Autowired
    @Qualifier("lmtPrdContService")
    private LmtPrdContService lmtPrdContService;

    @Autowired
    @Qualifier("cusIndivService")
    private CusIndivService cusIndivService;

    @Autowired
    private YedRepaymentInfoSyncServiceImpl repaymentInfoSyncService;

    @Autowired
    @Qualifier("nlsQueueSoltComnService")
    private NlsQueueSoltComnService nlsQueueSoltComnService;


}
